﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using Microsoft.Phone.Controls;
using Microsoft.Phone.Shell;
using RATSharp.Settings;
using System.Windows.Navigation;
using RATSharpW7.View;
namespace RATSharp.View
{
    /// <summary>
    /// Settings screen
    /// </summary>
    public partial class Settings : PhoneApplicationPage
    {
        AppSettings settings;
        public Settings()
        {
            InitializeComponent();
        }

        void doneButton_Click(object sender, EventArgs e)
        {
            settings.UsernameSetting = textBoxUsername.Text;
            settings.PasswordSetting = passwordBoxPassword.Password;
            settings.PathSetting = textBoxPath.Text;
            settings.PortSetting = textBoxPort.Text;
            settings.UrlSetting = textBoxUrl.Text;
            NavigationService.GoBack();
        }

        

        void cancelButton_Click(object sender, EventArgs e)
        {
            NavigationService.GoBack();
        }


        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            EventHandler eventHandler = NavigationContext.GetData<EventHandler>();
            settings = new AppSettings(eventHandler);
            //DataContext = model;
            //model.loadNotReturnedItems();

            //isNewPageInstance = false;
        }

    }
}